<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
</head>
<body>
	<canvas id="mycanvas" width="500px" height="400px" style="border:1px solid #ccc"></canvas>

</body>
</html>
<script type="text/javascript">
	var canvas = document.getElementById("mycanvas");
	var context = canvas.getContext("2d");
	var image = new Image();
	image.src = "D:/桌面/学习总结/大二上半学期/h5/lesson8/pepper.png";
	image.onload = function(){
		context.drawImage(image,10,20);
		context.drawImage(image,10,150,50,50);
		context.drawImage(image,10,10,20,20,100,150,200,200)
		                       /*截图位置*//*放置*//*截图大小*/
		// var imagedata = context.getImageData(20,20,100,100);
		// context.putImageData(imagedata,10,110)
	}
</script>